{% extends 'search_result.html' %}

{% block page_title %}
New Question in {{ groupname }}
{% endblock page_title %}

{% block main_div %}
<div class="col-md-10 col-md-offset-0">

        <form id="markdown-text" action="{{ request.get_full_path }}" method="POST" class="form-horizontal">
        {% csrf_token %}
        <div class="form-group text-left">
            <label for="inputTitle" class="col-sm-1 control-label"><span class="glyphicon glyphicon-pencil"></span></label>
            <div class="col-sm-11">
            {% block question_title %}<input type="text" class="form-control" id="inputTitle" placeholder="Enter your title ..." name="qtitle" {% if qtitle != None %}value="{{ qtitle }}"{% endif %}>{% endblock question_title %}
            </div>
        </div>
          <div id="editor" style="z-index:1;">
              <textarea id="q-md" name="qtext" style="display:none;">{% block question_content %}{% if qtext != None %}{{ qtext }}{% endif %}{% endblock question_content %}</textarea>
          </div>
          <div class="col-md-8">
            {% block question_tags %}<input type="text" class="form-control" name="qtags" placeholder="Enter tags, split by semicolons(;)" value="">{% endblock question_tags %}
          </div>
          <div class="col-md-2 navbar-right" style="margin-bottom: 200px;">
            <button class="btn btn-success navbar-right" type="submit" style="margin-right: 8px;">{% block button_text %}在讨论组&lt{{ groupname }}&gt发布新问题{% endblock button_text %}</button>
          </div>
          <script type="text/javascript">
            // function jssubmitText(n) = document.getElementById('markdown-text').action=""
          </script>
        </form>
      <script src="/static/editor.md/editormd.min.js"></script>
      <script type="text/javascript">
          $(function() {
              var editor = editormd("editor", {
                  // width: "100%",
                  height: "500px",
                  autoFocus: false,
                  placeholder: "使用Markdown编辑内容...",
                  // markdown: "xxxx",     // dynamic set Markdown text
                  path : "/static/editor.md/lib/"  // Autoload modules mode, codemirror, marked... dependents libs path
              });
          });
      </script>
      <script src="/static/editor.md/editormd.js"></script>
      <script src="/static/editor.md/lib/marked.min.js"></script>
      <script src="/static/editor.md/lib/prettify.min.js"></script>

</div>
{% endblock main_div %}